﻿<phone:PhoneApplicationPage 
    x:Class="SoccerLiveScores.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768" 
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        
        <!--Pivot Control-->
        <controls:Pivot x:Name="Pivot"
                        ItemsSource="{Binding PageCollection}"
                        Title="Live soccer scores"
                        HorizontalContentAlignment="Stretch"
                        VerticalContentAlignment="Stretch"
                        SelectionChanged="Pivot_SelectionChanged" Margin="0,0,0,63">
            <controls:Pivot.HeaderTemplate>
                <DataTemplate>
                    <Grid x:Name="grid">
                        <TextBlock TextWrapping="Wrap"
                                   Text="{Binding TitleText}"
                                   d:LayoutOverrides="Width, Height" />
                    </Grid>
                </DataTemplate>
            </controls:Pivot.HeaderTemplate>
            <controls:Pivot.ItemTemplate>
                <DataTemplate>
                    <ListBox x:Name="lstScores" ItemsSource="{Binding ContextCollection}">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Vertical" Height="75">
                                    <TextBlock Text="{Binding Title}" Width="450" TextWrapping="Wrap" Foreground="YellowGreen" FontSize="18" />
                                    <TextBlock Text="{Binding Description}" Width="450" TextWrapping="Wrap" FontSize="16"/>
                                    <TextBlock Text="{Binding PubDate}" Width="450" TextWrapping="Wrap" FontSize="16"/>
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </DataTemplate>
            </controls:Pivot.ItemTemplate>
        </controls:Pivot>
        <Button HorizontalAlignment="Left" Margin="0,696,0,0" Name="btnRefresh" Click="btnRefresh_Click" BorderBrush="{x:Null}">
            <Button.Content>
                <Image Source="./Icons/appbar.sync.rest.png" UseLayoutRounding="True" />
            </Button.Content>
        </Button>
        <TextBox Height="72" HorizontalAlignment="Left" Margin="91,696,0,0" Name="txtFilter" VerticalAlignment="Top" Width="460" TextChanged="txtFilter_TextChanged" AcceptsReturn="False" />
    </Grid>

</phone:PhoneApplicationPage>